<script lang="ts" setup>
import { isString } from '@vc/utils';

interface Props {
	infos: Function
  item: Record<string, any>
}

const {
  infos,
  item
} = defineProps<Props>();
</script>

<template>
  <vc-descriptions :column="2" border size="small" class="descriptions-content">
    <vc-descriptions-item
      v-for="(sub_item, sub_index) in infos(item)" :key="sub_index"
      :label="sub_item.name"
      :span="sub_item.span"
      label-align="left"
      align="left"
      :width="158"
    >
      <span v-if="!sub_item.value">-</span>
      <template v-else-if="isString(sub_item.value)">
        <vc-clamp autoResize :title="sub_item.value" :text="sub_item.value"/>
      </template>
      <component v-else :is="sub_item.value" />
    </vc-descriptions-item>
  </vc-descriptions>
</template>
